﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Private/Privada.master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="HRP.Private.Funcionarios.Index" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PrivadaMainContent" runat="server">
    <div class="page-heading animated fadeInDownBig">
        <h1>Funcionários</h1>
    </div>
    <asp:UpdatePanel runat="server" ID="FuncionarioPanel">
        <ContentTemplate>
            <div class="box-info full">
                <div class="data-table-toolbar">
                    <div class="row">
                        <div class="col-md-3">
                            <label>Departamento</label>
                            <asp:DropDownList AutoPostBack="true"
                                ID="departamentosList" CssClass="form-control selectpicker" runat="server" DataTextField="departamento" DataValueField="id">
                            </asp:DropDownList>
                        </div>
                        <div class="col-md-3">
                            <label>Cargo</label>
                            <asp:DropDownList AutoPostBack="true"
                                ID="cargoList" CssClass="form-control selectpicker" runat="server" DataTextField="Nome" DataValueField="Id">
                            </asp:DropDownList>
                        </div>
                        <div class="col-md-3">
                            <label>Activos</label>
                            <asp:DropDownList AutoPostBack="true"
                                ID="activosList" CssClass="form-control selectpicker" runat="server">
                                <asp:ListItem Text="Sim" Value="true"></asp:ListItem>
                                <asp:ListItem Text="Todos" Value="false"></asp:ListItem>
                            </asp:DropDownList>
                        </div>
                        <div class="col-md-3">
                            <div class="toolbar-btn-action">
                                <a class="btn btn-success md-trigger" href="Criar.aspx">Criar Novo Funcionário <i class="fa fa-plus-circle"></i></a>
                                <%--                        <a class="btn btn-danger"><i class="fa fa-trash-o"></i> Apagar</a>--%>
                                <%--                        <a class="btn btn-primary"><i class="fa fa-refresh"></i>Update</a>--%>
                            </div>
                        </div>
                    </div>

                    <%if (funcionariosTable.Items.Count == 0)
                      { %>
                    <h5>Não tem funcionários registados.
                    </h5>
                    <%} %>
                </div>
                <%if (funcionariosTable.Items.Count > 0)
                  { %>

                <asp:Repeater runat="server" ID="funcionariosTable">
                    <HeaderTemplate>
                        <div class="table-responsive">
                            <table data-sortable class="table table-hover table-striped">
                                <thead>
                                    <tr>
                                        <th style="width: 30px" data-sortable="false">
                                            <input type="checkbox" class="rows-check"></th>
                                        <th>Nº</th>
                                        <th>Nome</th>
                                        <th>Morada</th>
                                        <th>Telemóvel</th>
                                        <th>Email</th>
                                        <th>Activo</th>
                                        <th data-sortable="false">Opção</th>
                                    </tr>
                                </thead>
                                <tbody>
                    </HeaderTemplate>
                    <ItemTemplate>

                        <tr>
                            <td>
                                <input type="checkbox" class="rows-check"></td>
                            <td><%#Eval("numero_funcionario") %></td>
                            <td><%#Eval("nome") %></td>
                            <td><%#Eval("morada")%></td>
                            <td><%#Eval("telemovel")%></td>
                            <td><%#Eval("email")%></td>
                            <td><span class="label <%#(bool)Eval("activo") ? "label-success" : "label-danger"%> "><%#(bool)Eval("activo") ? "Sim" : "Não"%></span></td>
                            <td style="width: 100px;">
                                <div class="btn-group btn-group-xs">
                                    <asp:LinkButton ID="activarDesButton" data-toggle="tooltip" ToolTip='<%#(bool)Eval("activo") ? "Desactivar" : "Activar"%>' CssClass="btn btn-default" runat="server" CommandArgument='<%#Eval("id") %>' OnCommand="alterarEstadoFunc"><i class="fa fa-power-off"></i></asp:LinkButton>
                                    <a href='Ficha.aspx?id=<%#Eval("id") %>' data-toggle="tooltip" style='<%#(bool)Eval("activo") ? "": "display:none;"%>' title="Ver" class="btn btn-default"><i class="fa fa-eye"></i></a>
                                    <a href='Editar.aspx?id=<%#Eval("id") %>' data-toggle="tooltip" style='<%#(bool)Eval("activo") ? "": "display:none;"%>' title="Editar" class="btn btn-default"><i class="fa fa-edit"></i></a>
                                </div>
                            </td>
                        </tr>
                    </ItemTemplate>
                    <FooterTemplate></tbody></table></div></FooterTemplate>
                </asp:Repeater>

                <!-- TODO: Pagination -->
                <%--        <div class="data-table-toolbar">
            <ul class="pagination">
                <li class="disabled"><a href="#">&laquo;</a></li>
                <li class="active"><a href="#">1</a></li>
                <li><a href="#">2</a></li>
                <li><a href="#">3</a></li>
                <li><a href="#">4</a></li>
                <li><a href="#">5</a></li>
                <li><a href="#">&raquo;</a></li>
            </ul>
        </div>--%>
                <%} %>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
